home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Data 2002 May / CD Rom Data Mayıs 2002.iso / Freeware / Blitz Basic / data1.cab / Support / help / samples / lines2.bb < prev    next >
Encoding:
Text File  |  2002-04-10  |  1.2 KB  |  78 lines

  1. ;strange demo
  2. ;NO SHEEP THO' GEORGE ;)
  3. ;Copyright ⌐2000 EdzUp
  4. ;written by Ed Upton
  5.  
  6. ;adjust this for more lines
  7. Global lns=450
  8.  
  9. Graphics 640,480
  10. SetBuffer FrontBuffer()
  11.  
  12. Global r
  13. Global g
  14. Global b
  15. Global tim
  16. Global ss
  17.  
  18. ;X,Y screen coordinates
  19. ;F facing direction 
  20. ;T timer till it needs to change direction
  21. Type bit
  22.  Field x,y,f,t
  23. End Type
  24.  
  25. tim=Rnd(50)
  26. r=Rnd(255)
  27. g=Rnd(255)
  28. b=Rnd(255)
  29. ss=20
  30.  
  31. setup()
  32. While Not KeyDown(1)
  33.  update()
  34.  tim=tim-1
  35.  If tim<0
  36.   tim=50
  37.   ss=Rnd(20)
  38.   r=Rnd(255)
  39.   g=Rnd(255)
  40.   b=Rnd(255)
  41.  EndIf
  42. Wend
  43. End
  44.  
  45. ;setup lines
  46. Function setup()
  47.  For n=0 To lns
  48.   bitz.bit=New bit
  49.   bitz\x=Rnd(640)
  50.   bitz\y=Rnd(480)
  51.   bitz\f=Rnd(3)
  52.   bitz\t=Rnd(20)
  53.  Next
  54. End Function
  55.  
  56. ;update function
  57. Function update()
  58.  For bitz.bit=Each bit
  59.   Color r,g,b
  60.   Plot bitz\x,bitz\y
  61.   bitz\t=bitz\t-1
  62.   If bitz\t<=0
  63.    bitz\f=bitz\f+1
  64.    If bitz\f>3 Then bitz\f=0
  65.    bitz\t=ss
  66.   EndIf
  67.   If bitz\f=0 Then bitz\y=bitz\y-1
  68.   If bitz\f=1 Then bitz\x=bitz\x+1
  69.   If bitz\f=2 Then bitz\y=bitz\y+1
  70.   If bitz\f=3 Then bitz\x=bitz\x-1
  71.   If bitz\x<0 Then bitz\x=639
  72.   If bitz\x>639 Then bitz\x=0
  73.   If bitz\y<0 Then bitz\y=479
  74.   If bitz\y>479 Then bitz\y=0
  75.   Color 255,255,255
  76.   Plot bitz\x,bitz\y
  77.  Next
  78. End Function